Interface of Web Service Operations |
This topic provides an overview of the interface part of a Web service operation. |
|
Web Services Description Language (WSDL)
The WSDL contains the description about the following:
- Request and the Response objects
- Parameters passed for the request and their data types
- Response type
- Parameters of the Response and their data types
The WSDL contains the information about the input and output of the Web service Operations in LDAP. Such information can be used by any browser based application to query information/inputs that needs to be supplied to the back end.
The WSDL is stored as thebusmethodsignatureparameter of the LDAP Web service operation and has the following structure:
<definitions name="method name" targetNamespace="namespace"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="namespace">
<types/>
......
<message/>
......
<portType/>
......
<binding/>
......
<service/>
......
</definitions>
In the above structure:
- types- contains definitions of XML schemas
- message- contains descriptions of documents that comply with XSDs from the types
- portType- contains the description of a 'Web service operation signature'
- binding- defines message format and protocol details for operations and messages.
- service- represents a service, which groups related ports to provide some functionality.
The definition contains the attributes such as name (Web service operation name), targetNamespace (Points to the labeledURI of the Web service interface). Each portType contains an operation. This is a Web service operation that is specifically defined (for example GetEmployees ). The portType structure is defined as follows:
<portType name="Method Set Name">
<operation name="MethodName">
<input message="Methodrequestreference"/>
<output message="Methodresponsereference"/>
</operation>
</portType>
Each operation within the portType hasinputandoutput. These inputs and outputs are messages, and therefore are required to be defined in one of the <message> elements at the top. As a result, the contents of these messages are defined in the schemas that go under the <types> element at the top.
Themessagecontains apart. These are the request and the response names that the<input/>and the<output/>tags are referencing in the operation. The<message/>structure is as follows:
<message name="message request/response name">
<part name="body" element="request/response name">
</message>
The types tag contains the schema definition and the element definitions of the request and response involved in the Web service operation.
<types>
<schema targetNamespace="namespace" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="request">
<complexType>....</complexType>
</element>
<element name="response">
<complexType>....</complexType>
</element>
</schema>
</types>
The elements for request and response contains the definitions for the input and output parameters involved. The parameters can be of a complex Type (which contains sub nodes and data under them) or a simple type (which is self descriptive, and does not expand). The structure for the simpleType and complexType are as follows :
<element name="complex-element">
<complexType>
<all>
<element name="simple-element">
<simpleType>
<restriction base="type definition">
<length value="length"/>
</restriction>
</simpleType>
</element>
</all>
</complexType>
</element>
XSD
XSDs can be created as an LDAP Web service operation of object class 'busmethodtype' in addition to 'busmethod'. These XSDs can be used by front end or back end tools to display data and parameters for the return type. An XSD has the following structure:
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<complexType>
<all>
<element/>
...
...
</all>
</complexType>
</schema>
In the above structure:
- schemacontains the XML Schema definition of a business object.
- elementcontains the element definitions involved in the business object return type.
The <element/> definition can have the following structures:
<element>
<complexType>
<all>
<element>
<simpleType>
....
</simpleType>
</element>
</all>
</complexType>
</element>
In the above structure, it can be found that there can be two types of elements possible:
- Complex Type - Items which can contain children nodes under them and are expandable. These can have more elements under them.
- Simple Type - Items which cannot contain child nodes under them (last level of an element).